package org.jetnuke.modules.your_account;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.jforum.entities.Theme;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.ActionForward;
import org.jetnuke.common.IAction;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IModuleInfo;
import org.jetnuke.common.IUserInfo;

public class Preview implements IAction {
	int theme;

	public void setTheme(int theme) {
		this.theme = theme;
	}
	public ActionForward exec(HttpServletRequest request,
			HttpServletResponse response, VelocityContext vc, IModuleInfo info,
			String op, IUserInfo ui, IAdminInfo ai) throws Exception {
		vc.put("_id",new Integer(ui.getID()));
		
		String _styleFolder = "_styleFolder";
		String currentStyle=null;
		try {
			Theme tm=net.jforum.dao.DataAccessDriver.getInstance().newThemeDAO().selectByID(theme);
			currentStyle = tm.getStyleName();
		} catch (Throwable e) {
				
		}
		if(currentStyle!=null)
			vc.put(_styleFolder, "style/" + currentStyle);
		vc.put("_currentStyle",currentStyle);
		
		return new ActionForward(op, info);
	}

}
